<?xml version="1.0" encoding="UTF-8" ?>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="html-header.jsp"%>
</head>
<body>
	<div class="content">
		<%@ include file="header.jsp"%>
		<div class="box">
			<div class="statusbox">
				Status:
				<c:choose>
					<c:when test="${sessionScope.restart == null }">
						<span class="statusValid"> <b>CRM is up!</b></span>
					</c:when>
					<c:otherwise>
						<span class="statusInvalid"> <b>Changes will take effect when you restart server</b></span>
					</c:otherwise>
				</c:choose>
			</div>
			<div class="properties">
				<table class="buttons">
					<tr>
						<td>
							<form id="saveForm" action="crm.do?action=save" method="post"
								class="form" onsubmit="javascript:updateHiddenField();">
								<input class="submit" type="submit" value="Save" /> <input
									type="hidden" id="propsMap" name="propsMap" value="" />
							</form>
						</td>
						<td>
							<form action="crm.do" method="post" class="form">
								<input class="submit" type="submit" value="Cancel" />
							</form>
						</td>
					</tr>
				</table>
				<center>
					<c:choose>
						<c:when test="${fn:length(properties) > 0}">
							<table class="table">
								<tr class="head">
									<th class="name">Name</th>
									<th>Value</th>
								</tr>
								<c:forEach items="${properties }" var="item">
									<tr class="props">
										<td>${item.key }</td>
										<td><input class="input" type="text" size=30
											id="${item.key }" value="${item.value }" /></td>
									</tr>
								</c:forEach>
							</table>
						</c:when>
						<c:otherwise>
							<b>Nothing found to display.</b>
							<br />
						</c:otherwise>
					</c:choose>
				</center>
			</div>
		</div>
	</div>
	<div class="bottom">
		<%@ include file="footer.jsp"%>
	</div>
	<script type="text/javascript">
		function updateHiddenField() {
			var props = new Array();
			var keys = "${propsKeys }";
			keys = keys.substring(1, keys.length-1);
			var array = keys.split(", ");
			for (var key in array) {
				props[key] = array[key] + "=" + document.getElementById(array[key]).value;
			}
			document.getElementById("propsMap").value = props;
			document.getElementById("saveForm").submit();
			return false;
		}
	</script>
</body>
</html>